<?php
/**
 * @Name: UsersModel.php
 * @Author: yashuai<1762910894@qq.com>
 */

namespace app\common\model\rbac;

use app\common\model\BaseModel;

class UsersModel extends BaseModel
{

    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'UserID';

    /**
     * 数据表名
     * @var string
     */
    protected $table = 'db_admin_user';

    /**
     * 关联用户角色
     */
    public function role()
    {
        return $this->hasMany(UsersRoleModel::class, 'UserID', 'UserID')
            ->field(['UserID', 'RoleID']);
    }
}
